import {Component, OnInit} from '@angular/core';

@Component({
    templateUrl: './development-ma-details.component.html',
    styleUrls: ['./development-ma-details.component.css']
})
export class DevelopmentMaDetailsComponent implements OnInit {

    input: any;

    constructor() {
    }

    ngOnInit() {
        const funcWrappend = this.performanceTimingDecorator(this.func);
        funcWrappend();
    }

    performanceTimingDecorator(func: Function) {
        return function (...args) {
            const start = Date.now();
            func(...args);
            const end = Date.now();
            const t = end - start;
            console.log(`函数执行时间${t}ms`);

        }
    }

    func() {
        for (let i = 0; i < 2000; i++) {
            console.log('1');
        }
    }
}
